package com.example.homelicaisystem.dao;

import com.example.homelicaisystem.entity.*;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface UserMapper {

    boolean phoneExists(@Param("phone") String phone);

    boolean idExists(@Param("id") Integer id);


    List<SelectResult> select();

    //添加用户
    void insertUser(User data);

    //查看用户
    List<User> getList();

    //删除用户
    void delete(int id);

    //修改用户
    void update(User data);

    //分页查看
    Page<User> getList(User data);

    //登录
    User login(User data);

    //根据phone获取id
    int getId(String phone);

    //判断是否有权限
    boolean hasPower(@Param("userId") Integer userId, @Param("permission") String permission);

    //获取权限
    List<Power> getPower(int id);


    User getUserById(Integer id);

    void updateCash(User date);

    User getUserByPhone(String phone);

    void insertUserPower(Integer userId,Integer powerId);

    void deleteUserPower(int userId);



}
